<?php

namespace app\admin\model;

use think\Model;

class MemberLevel extends Model
{
    protected $pk = 'level_id';
    protected static function init()
    {
        self::event('before_insert', function ($data) {
            $data->discount = json_encode($data->discount);
        });
        self::event('before_update', function ($data) {
           $data->discount = json_encode($data->discount);
        });
    }

}
